﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace AnalysisVideoSubtitle
{
    public partial class VoiceSetFrm : Form
    {
        public VoiceSetFrm()
        {
            InitializeComponent();
        }

        private void BtnSave_Click(object sender, EventArgs e)
        {
            Data.spd = (int)num_spd.Value;
            Data.pit = (int)num_pit.Value;
            Data.vol = (int)num_vol.Value;
            switch (cb_per.SelectedIndex)
            {
                case 0:
                    Data.per = 0;
                    break;
                case 1:
                    Data.per = 1;
                    break;
                case 2:
                    Data.per = 3;
                    break;
                case 3:
                    Data.per = 4;
                    break;
                default:
                    Data.per = 4;
                    break;
            }
            SettingData.WriteIniData();
            this.Close();
        }

        /// <summary>
        /// 加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void VoiceSetFrm_Load(object sender, EventArgs e)
        {
            num_spd.Value = Data.spd;
            num_pit.Value = Data.pit;
            num_vol.Value = Data.vol;
            switch (Data.per)
            {
                case 0:
                    cb_per.SelectedIndex = 0;
                    break;
                case 1:
                    cb_per.SelectedIndex = 1;
                    break;
                case 3:
                    cb_per.SelectedIndex = 2;
                    break;
                case 4:
                    cb_per.SelectedIndex = 3;
                    break;
                default:
                    cb_per.SelectedIndex = 3;
                    break;
            }
        }
    }
}
